
<style type="text/css">
.err{
	font-family:tahoma;
	color:#FFFFFF;
	font-size:12px;	
}

</style>
<script language="javascript">
function btnLogin_onclick(){
	if(test_empty(document.frmLogin.txtUid.value)){
		alert(mustInput_Uid);document.frmLogin.txtUid.focus();return false;
	}
	if(test_empty(document.frmLogin.txtPwd.value)){
		alert(mustInput_Pwd);document.frmLogin.txtPwd.focus();return false;
	}
	return true;
}
</script>
<? $errMsg =''?>
<?
$l_notmember = $_lang == 'vn' ? 'Not member' : 'Not member';
$l_member    = $_lang == 'vn' ? 'Member' : 'Member';

$l_Uid       = $_lang == 'vn' ? 'Username' : 'Username';
$l_Pwd       = $_lang == 'vn' ? 'Password' : 'Password';
$l_ForgotPwd = $_lang == 'vn' ? 'Forgot Password' : 'Forgot Password';

$l_btnRegistry = $_lang == 'vn' ? 'Registry' : 'Registry';
$l_btnLogin    = $_lang == 'vn' ? 'Login' : 'Login';
$l_btnLogout   = $_lang == 'vn' ? 'Logout' : 'Logout';

$l_Welcome      = $_lang == 'vn' ? 'Welcome' : 'Welcome';
$l_LoginSuccess = $_lang == 'vn' ? 'Login Successfully.' : 'Login Successfully.';

if ($_REQUEST['frame']=='logout'){
	unset($_SESSION['member']);
	echo "<script>window.location='./'</script>";
}
if(!isset($_SESSION['member']) || $_SESSION['member']==''){
	$flagLogin = false;
}else{
	$flagLogin = true;
}

/*if($_REQUEST['boxUid']!=''){
	$uid = $_REQUEST['boxUid'];
	$pwd = $_REQUEST['boxPwd'];
	
	if(!isset($_SESSION['member']) || $_SESSION['member']==''){
		$result = mysql_query("select * from tbl_member where uid='".$uid."'",$conn);
		$rows = mysql_num_rows($result);
		if($rows<1){
			$errMsg = $_lang == 'vn'?'Username wrong!':'Username wrong !';
		}else{
			$row = mysql_fetch_array($result);
			if($pwd != $row['pwd']){
				$errMsg = $_lang == 'vn'?'Password wrong !':'Password wrong !';
			}else{
				$flagLogin = true;
			}
		}
	}
}

if (isset($_POST['btnLogin'])){
	$uid = isset($_POST['txtUid']) ? trim($_POST['txtUid']) : "";
	$pwd = isset($_POST['txtPwd']) ? trim($_POST['txtPwd']) : "";
	
	if(!isset($_SESSION['member']) || $_SESSION['member']==''){
		$result = mysql_query("select * from tbl_member where uid='".$uid."'",$conn);
		$rows = mysql_num_rows($result);
		if($rows<1){
			$errMsg = $_lang == 'vn'?'Username wrong !':'Username wrong !';
		}else{
			$row = mysql_fetch_array($result);
			if($pwd != $row['pwd']){
				$errMsg = $_lang == 'vn'?'Password wrong  !':'Password wrong !';
			}else{
				$flagLogin = true;
			}
		}
	}
}
*/
if($flagLogin){
	$_SESSION['member'] = isset($_SESSION['member'])?$_SESSION['member']:$uid;
?>
		<?=$l_Welcome.' <b class="fontRed">'.$_SESSION['member'].'</b>'?>
		[<a class="aMagenta" href="./?frame=logout"><?=$l_btnLogout?></a>]
<?
}else{
?>
<!--span><a href="./?frame=registry" class="text_menu">Register</a></span>
<span><a href="./?frame=login" class="text_menu">Login</a></span0-->
 					
<? }?>

<? if($errMsg!=''){echo '<span style="color:#89B554; font-size:12px; ">'.$errMsg.'</span>';
	echo '<br/>';
}?> 
